From 60f645cf0b2b766eff322ba91bd955848483c885 Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Thu, 20 Mar 2008 20:54:29 +0000 Subject: [PATCH] Per Brion's suggestion, show the selected options too for the Pager stuff, with no link, just as we do for the other bits. --- includes/Pager.php | 51 ++++++++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 20 deletions(-) diff --git a/includes/Pager.php b/includes/Pager.php index fafbd9cdbe..fdd883a27f 100644 --- a/includes/Pager.php +++ b/includes/Pager.php @@ -509,17 +509,25 @@ abstract class AlphabeticPager extends IndexPager { wfMsgHtml( 'viewprevnext', $pagingLinks['prev'], $pagingLinks['next'], $limits ); - # Which direction should the link go? Opposite of the current. - $dir = $this->mDefaultDirection ? 'asc' : 'desc'; - $query = array( 'direction' => $dir ); - if( $this->mOrderType !== null ) { - $query['order'] = $this->mOrderType; - } - # Note for grep: uses pager-sort-asc, pager-sort-desc - $this->mNavigationBar .= ' (' . $this->makeLink( - wfMsgHTML( "pager-sort-$dir" ), - $query - ) . ')'; + $dirlinks = array(); + # Note for grep: uses pager-sort-asc, pager-sort-desc (each in two + # places) + foreach( array( 'asc', 'desc' ) as $dir ) { + if( ($this->mDefaultDirection ? 'desc' : 'asc' ) == $dir ) { + # Don't print a link, just some text + $dirlinks[$dir] = wfMsgHTML( "pager-sort-$dir" ); + } else { + $query = array( 'direction' => $dir ); + if( $this->mOrderType !== null ) { + $query['order'] = $this->mOrderType; + } + $dirlinks[$dir] = $this->makeLink( + wfMsgHTML( "pager-sort-$dir" ), + $query + ); + } + } + $this->mNavigationBar .= ' (' . implode( ' | ', $dirlinks ) . ')'; if( !is_array( $this->getIndexField() ) ) { # Early return to avoid undue nesting @@ -530,17 +538,20 @@ abstract class AlphabeticPager extends IndexPager { $first = true; $msgs = $this->getOrderTypeMessages(); foreach( array_keys( $msgs ) as $order ) { - if( $order == $this->mOrderType ) { - continue; - } - if( !$first ) { - $extra .= ' | '; + if( $first ) { $first = false; + } else { + $extra .= ' | '; + } + + if( $order == $this->mOrderType ) { + $extra .= wfMsgHTML( $msgs[$order] ); + } else { + $extra .= $this->makeLink( + wfMsgHTML( $msgs[$order] ), + array( 'order' => $order ) + ); } - $extra .= $this->makeLink( - wfMsgHTML( $msgs[$order] ), - array( 'order' => $order ) - ); } if( $extra !== '' ) { -- 2.20.1